﻿/*----------------------------------------------------------------
  //Copyright (C) 2012 赵国伟
  //文件功能描述：词典管理Ajax请求服务端处理程序。
  //创建人：赵国伟
  //创建时间：2012-04-05 12:34:54
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Shopping.Common;
using Shopping.BLL;
using Shopping.Model;

public partial class Manage_AS_DictionaryCommon : BaseManagePage
{
    private readonly DictionariesManage bllDict = new DictionariesManage();
    private ReturnValue ret = new ReturnValue(ResultType.Fail); 

    protected void Page_Load(object sender, EventArgs e)
    {
        string action = Request.QueryString["Action"] as string;
        switch (action)
        {
            case "SaveDictionary":   //保存词典信息； by 赵国伟 2012-04-05
                SaveDictionary();
                break;
            case "GetDictionaryInfo":  //获取一条词典信息；by 赵国伟 2012-04-05
                GetDictionaryInfo();
                break;
            case "DeleteDictionary":  //删除一条词典信息； by 赵国伟 2012-04-05
                DeleteDictionary();
                break;
        }
        Response.End();
    }


    #region "保存词典信息 by 赵国伟 2012-04-05"
    /// <summary>
    /// 保存词典信息
    /// </summary>
    private void SaveDictionary()
    {
        ret = BLLHelper.Save<DictionariesManage, Dictionaries>("Save");
        Response.Write(ret.ToJsonString());
    }
    #endregion

    #region "查询一条词典信息 by 赵国伟 2012-04-05"
    /// <summary>
    /// 查询一条词典信息
    /// </summary>
    private void GetDictionaryInfo()
    {
        int DictionaryID = Utility.Cast2int(Utility.G("DictionaryID"));
        Dictionaries data = bllDict.GetDictionaryInfo(DictionaryID);
        if (data != null)
            Response.Write(data.ToJsonString());
    }
    #endregion

    #region "删除指定的词典信息 by 赵国伟 2012-04-05"
    /// <summary>
    /// 删除指定的词典信息
    /// </summary>
    private void DeleteDictionary()
    {
        int DictionaryID = Utility.Cast2int(Utility.G("DictionaryID"));
        Response.Write(bllDict.Delete(DictionaryID));
    }
    #endregion



}